import java.util.Scanner;


public class DictionaryTester {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Dictionary dict = new Dictionary();
		String input = "";
		Scanner sc = new Scanner(System.in);
		while ( input != "exit"){
			input = sc.next();
			if(dict.check(input)) System.out.println(input + " is a valid term!");
			else System.out.println(input + " is INVALID !!");	
			
		}

	}

}
